home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / bbs / cddk9606.zip / HEADERS.ARJ / SOUNDS.INT < prev    next >
Text File  |  1996-06-14  |  3KB  |  81 lines

  1.  
  2. { ───────────────────────────────────────────────────────────────────────── }
  3. {  SOUNDS: PC-Speaker routines                                              }
  4. {  Copyright 1996 David Pinch ∙ All Rights Reserved Worldwide               }
  5. { ───────────────────────────────────────────────────────────────────────── }
  6.  
  7. UNIT Sounds;
  8.  
  9. {$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
  10. {$F+} { . . . . . . . . . . . . . . . . . . . .  Force far calls for safety }
  11. {$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
  12. {$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
  13. {$Q-} { . . . . . . . . . . . . . .  Do not generate overflow-checking code }
  14. {$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
  15. {$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
  16. {$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
  17.  
  18. INTERFACE
  19.  
  20. {#Start}
  21.  
  22. PROCEDURE Ring;
  23.   {
  24.   PURPOSE  : Simulates a telephone ring on the local computer.
  25.  
  26.   SEE ALSO : Siren
  27.   }
  28.  
  29.  
  30. PROCEDURE Siren(Resolution,Amplitude,Midline,DelayFactor,Count:Word);
  31.   {
  32.   PURPOSE  : Generates a cosine siren on the local computer.
  33.  
  34.   NOTES    : A cosine curve looks something like this:
  35.  
  36.               1    ∙  .                               .  ∙
  37.                    │     ∙                         ∙
  38.                    │       ∙                     ∙
  39.                    │        ∙                   ∙
  40.               0  ──┼───────────────────────────────────────
  41.                    │         ∙                 ∙
  42.                    │          ∙               ∙
  43.                    │            ∙           ∙
  44.              -1    │               ∙  .  ∙
  45.  
  46.                    0        π/2       π        3π/2      2π
  47.  
  48.              Notice that the cosine graph repeats one full cycle every
  49.              2π (6.28) units.  This is the basis for many different sirens.
  50.              The sound at any given point is calculated from this curve.
  51.  
  52.   PARAMS   :  Resolution  The cosine curve is divided into a large number
  53.                           of steps.  The siren cycles through each step and
  54.                           creates a sound based on the curve at that step.
  55.                           The number of steps is the resolution of the siren.
  56.  
  57.               Amplitude   Each step is multiplied by the amplitude.  Since
  58.                           the peaks of the curve have a maximum value of +1
  59.                           and a minimum value of -1, this generates an
  60.                           effective range of -Amplitude to +Amplitude.
  61.  
  62.               Midline     The middle frequency (i.e. the line through the
  63.                           middle of the curve).  The final range of the
  64.                           siren is Midline-Amplitude to Midline+Amplitude.
  65.  
  66.               Delay       This parameter allows you to tweak the speed of
  67.                           the siren, which is dependent of the clock speed
  68.                           of the CPU.  Adjust this factor if the siren
  69.                           sounds bad.
  70.  
  71.               Count       The number of times to repeat the siren.
  72.  
  73.   SEE ALSO : Ring
  74.   }
  75.  
  76. IMPLEMENTATION
  77.  
  78. { The source code is available upon registration. }
  79.  
  80. END.
  81.